from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import String, Column, Integer, create_engine
from sqlalchemy.orm import sessionmaker
import sys
import os.path

parent_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(parent_path)
from settings import *

Base = declarative_base()


class Host(Base):
    __tablename__ = "hosts"

    host_id = Column(Integer, primary_key=True)
    host_name = Column(String(128), nullable=False)
    host_ip = Column(String(64), nullable=False)
    host_status = Column(String(16), default="")


engine = create_engine(DATABASE)
DBSession = sessionmaker(engine)
